#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
@Project : gtmsAutoTestProject 
@File    : shop_api.py
@IDE     : PyCharm 
@Author  : Mario
@Date    : 2022/4/26 18:43 
@Describe: 中台运营门店相关接口
"""
from Comm.tools.toolsControl import ToolsHandler
from APIs.middleApi.base_middle_api import BaseMiddleApi


class ShopApi(BaseMiddleApi):
    def __init__(self, environment):
        super().__init__(environment)

    def get_shop_info(self, brandCode):
        """
        获取门店信息
        :param brandCode: 品牌编码
        :return:
        """
        shopCode = ToolsHandler.get_shopCode(brandCode)
        payload = '{"brandCode":"' + brandCode + '","shopCode":"' + shopCode + '"}'
        response = self.http_requests('catering-backend/shop/base/list', payload)
        return response

    def get_shop_table_code(self, brandCode, tableCode):
        """
        获取门店台位列表信息
        :param brandCode: 品牌编码
        :param tableCode: 台位号
        :return:
        """
        shopCode = ToolsHandler.get_shopCode(brandCode)
        payload = '{"pageNum":1,"pageSize":10,"shopCode":"' + shopCode + '","tableCode":"' + tableCode + '"}'
        response = self.http_requests('catering-backend/shop/table/list', payload)
        return response


if __name__ == '__main__':
    test = ShopApi('sit')
    test.get_shop_table_code('823882', '340')
